﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace Admin.Models
{
    public class RoleViewModel
    {
        public string Id { get; set; }
        [Required(AllowEmptyStrings = false)]
        [Display(Name = "RoleName")]
        public string Name { get; set; }
    }

    public class EditUserViewModel
    {
        public string Id { get; set; }

        [Required(ErrorMessage ="请输入用户名")]
        [Display(Name = "用户名")]
        public string UserName { get; set; }

        //[Required(AllowEmptyStrings = false)]
        [Display(Name = "Email")]
        [EmailAddress]
        public string Email { get; set; }

        public IEnumerable<SelectListItem> RolesList { get; set; }
    }

    public class UserViewModel
    {
        public string Id { get; set; }

        [Required(ErrorMessage = "请输入用户名")]
        public string UserName { get; set; }

        [Required(ErrorMessage = "请输入邮箱")]
        [EmailAddress(ErrorMessage = "请输入合法的邮箱地址")]
        [Display(Name = "Email")]
        public string Email { get; set; }

        //[Required(ErrorMessage = "请输入密码")]
        //[StringLength(100, ErrorMessage = "{0}长度至少为 {2} 个字符.", MinimumLength = 6)]
        //[DataType(DataType.Password)]
        //[Display(Name = "Password")]
        //public string Password { get; set; }

        //[DataType(DataType.Password)]
        //[Display(Name = "Confirm password")]
        //[System.ComponentModel.DataAnnotations.Compare("Password", ErrorMessage = "两次密码输入不一致.")]
        //public string ConfirmPassword { get; set; }

        [UIHint("MultiLevel")]
        public List<SelectItem> RoleList { get; set; }
    }

    public class SelectItem
    {
        public string Text { get; set; }

        public string Value { get; set; }
    }
}